package com.qjc.demo.algorithm.LRUOfLinkedHashMap;

/**
 * @ClassName: LRUCacheTest
 * @Description: 手写一个LRU算法：最近最久未使用
 * @Author: qjc
 * @Date: 2022/5/9 5:05 PM
 */
public class LRUCacheTest {
    public static LRUCache<String, Object> cache = new LRUCache<>(10);

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            cache.put("k" + i, i);
        }
        System.out.println("all cache :" + cache);
        cache.get("k3");
        System.out.println("get k3 :" + cache);
        cache.get("k4");
        System.out.println("get k4 :" + cache);
        cache.get("k4");
        System.out.println("get k4 :" + cache);
        cache.put("k" + 10, 10);
        cache.put("k" + 11, 11);
        cache.put("k" + 12, 12);
        cache.put("k" + 13, 13);
        System.out.println("After running the LRU algorithm cache :" + cache);
    }

}